<template>
	<view class="set-height1">
		<view class="login-bigbox">
			<!-- <view class="login-top-img">
				<image class="img" src="../../static/img/img_logo_blue.png" alt="" mode="widthFix" />
			</view> -->
		</view>
		<view class="login-inpbox">
			<view class="login-item username-box flex rcs">
				<image class="login-item-icon user-img" src="../../static/icon/icon_login_user.png" mode="widthFix" />
				<input class="flex-1 input-item" type="text" v-model="number" placeholder="请输入账号" />
			</view>
			<view class="login-item password-box flex rcs">
				<image class="login-item-icon pass-img" src="../../static/icon/icon_login_lock.png" mode="widthFix" />
				<input class="flex-1 input-item" placeholder="请输入密码" v-model="password" type="password" />
			</view>
		</view>
		<view class="posit">
			<view class="affirm" @tap="handleClickLogin">立即登录</view>
			<view class="other-btn-wrap flex rcb">
				<view class="other-btn-item"  @tap="onPressToNavigate(1)">忘记密码？</view>
				<view class="other-btn-item"  @tap="onPressToNavigate(2)">立即注册</view>
			</view>
		</view>
		<view class="bottom-imgbox">
			<!-- <image class="btm-img" src="../../static/img/img_bg_login_bottom.png" mode="widthFix" /> -->
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				number: '',
				password: '',
				msg: '',
				DEBUG: this.__DEV__
			}
		},
		methods: {
			// 点击注册
			onPressToNavigate(type) {
				let component = type > 1 ? '/pages/login/register' : '/pages/login/recover_password'
				uni.navigateTo({
					url: component,
				});
			},
			// 点击登录
			async handleClickLogin() {
				let url = this.ServicesApi.login;
				let data = {
					emp_no: this.number,
					password: this.password
				};
				let result = await this.Services.post(url, data);
				if (result.code == this.StatusCode.SUCCESS_CODE) {
					let token = result.data.token;
					uni.setStorageSync('login_key', token);
					this.LocalStore.token = token;
					uni.reLaunch({
						url: "/pages/work_bench/index",
						// url: "/pages/talent_pool/index",
					});
				} else {
					uni.showToast({
						icon: 'none',
						title: result.msg,
					});
				}
			}
		}
	}
</script>

<style scoped lang="stylus">
	.set-height1 {
		// height:100vh;
		// width:100%;
		background: #fff;
		display: flex;
		flex-direction: column;
		// position:absolute;
		height: 100%;
		width: 100%;
		position: absolute;
		top: 0px;
		bottom: 0px;
		background-image: url('~@/static/img/img_bg_login_bottom.png');
		background-size: 100% auto;
		background-repeat: no-repeat;
		background-position: bottom;
	}

	.login-bigbox {
		padding-top: 220rpx;
		background-image: url('~@/static/img/img_bg_login_top.png');
		background-position: right top;
		background-repeat: no-repeat;
		background-size: auto 220rpx;
		background-color: #FFFFFF;

		.login-top-img {
			height: 84upx;
			width: 344upx;
			margin: 0 auto;

			.img {
				height: 84upx;
				width: 344upx;
			}
		}
	}

	.login-inpbox {
		padding: 0 40rpx;
		background: #fff;

		.login-item {
			height: 90rpx;
			margin: 30upx 0;
			border-bottom: 2upx solid #DBDBDB;

			.login-item-icon {
				width: 40rpx;
				height: 40rpx;
				margin-right: 20upx;
			}

			.input-item {
				height: 80rpx;
			}
		}
	}

	.msg-title {
		color: red;
		font-size: 28upx;
	}

	.res {
		font-size: 36upx;
		color: #066FE9;
		text-align center;
		position absolute;
		top: 0;
		left: 0;
		bottom: 0;
		right: 0;
		z-index: 100
	}

	.posit {
		position: relative;
	}

	.affirm{
		height:90upx;
		background:linear-gradient(270deg,rgba(0,106,231,1) 0%,rgba(66,157,255,1) 100%);
		text-align:center;
		line-height:90upx;
		color:#fff;
		font-size:32upx;
		border-radius:4upx;
		margin: 80rpx 40rpx 30rpx;
	}
	.other-btn-item {
		color: #333333;
		margin: 0 40rpx;
	}

	.bottom-imgbox {
		flex: 1;
		height: 420rpx;
		display: flex;
		align-items: flex-end;

		.btm-img {
			width: 100%;
			height: 420rpx;
		}
	}
</style>
